home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CAircraftCessna.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  6.1 KB  |  227 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CAircraftCessna extends CAircraft
  13.    {
  14.        
  15.       
  16.       private var mPath:CPath;
  17.       
  18.       private var mTrackSoundID:String;
  19.       
  20.       public function CAircraftCessna(param1:CPosition)
  21.       {
  22.          if(true)
  23.          {
  24.             super(param1);
  25.             if(true)
  26.             {
  27.                mType = "cessna";
  28.                if(true)
  29.                {
  30.                   Process = Process_Normal;
  31.                   if(true)
  32.                   {
  33.                      mAngle = new CAngle();
  34.                      if(true)
  35.                      {
  36.                         mDelta = new CPosition();
  37.                         if(true)
  38.                         {
  39.                            mMaxLife = mLife = 100;
  40.                            if(true)
  41.                            {
  42.                               mMaxSpeed = 27 * mSpriteScalar * mEnemySpeed;
  43.                               if(true)
  44.                               {
  45.                                  mSpeed = mMaxSpeed;
  46.                                  if(true)
  47.                                  {
  48.                                     mAcceleration = 1;
  49.                                  }
  50.                                  mOrientation = -1;
  51.                               }
  52.                               SetTargetting(650,true,FILTER_GroundTargets,true,300);
  53.                            }
  54.                            AddAnimation("stand",Cessna,"AddSprite_Scale");
  55.                         }
  56.                         SetCollisionBySprite(mAnimation[0]);
  57.                      }
  58.                      AddLoopingSound("flight",Cessna_Flight);
  59.                   }
  60.                   mTrackSoundID = PlaySound("flight");
  61.                }
  62.                SetState("SEARCHTARGET");
  63.             }
  64.             IncrementBuild();
  65.          }
  66.       }
  67.       
  68.       override public function Dispose() : void
  69.       {
  70.          if(mDisposed)
  71.          {
  72.             return;
  73.          }
  74.          super.Dispose();
  75.          StopSound(mTrackSoundID);
  76.       }
  77.       
  78.       public function State_SEARCHTARGET_Exit() : void
  79.       {
  80.       }
  81.       
  82.       public function State_SEARCHTARGET() : void
  83.       {
  84.          mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
  85.          mPosition.Sub(mDelta);
  86.          if((mCurrentTarget = GetTarget()) != null)
  87.          {
  88.             SetState("FOLLOWPATH");
  89.             return;
  90.          }
  91.       }
  92.       
  93.       public function State_FOLLOWPATH_Enter() : void
  94.       {
  95.          mPath = new CPath();
  96.          ┬º┬ºpush(mPath);
  97.          if(true)
  98.          {
  99.             ┬º┬ºpop().SetPath([mPosition,new Point((mPosition.x + mCurrentTarget.mPosition.x) / 2,mPosition.y),mCurrentTarget.mPosition]);
  100.             ┬º┬ºpush(mPath);
  101.          }
  102.          ┬º┬ºpop().OrientateThing(this);
  103.          mMaxSpeed *= 2;
  104.       }
  105.       
  106.       public function State_FOLLOWPATH_Exit() : void
  107.       {
  108.       }
  109.       
  110.       public function State_SEARCHTARGET_Enter() : void
  111.       {
  112.       }
  113.       
  114.       public function State_NOPATH() : void
  115.       {
  116.          mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
  117.          mPosition.Add(mDelta);
  118.       }
  119.       
  120.       override public function Draw() : void
  121.       {
  122.          if(true)
  123.          {
  124.             super.Draw();
  125.             if(true)
  126.             {
  127.                mAnimationFrame += 0.25;
  128.                GetAnimationFrame();
  129.             }
  130.             DrawSprite(GetOrientationMatrix());
  131.          }
  132.       }
  133.       
  134.       public function Process_Normal() : void
  135.       {
  136.          var _loc1_:Point = null;
  137.          if(true)
  138.          {
  139.             Accelerate_Speed();
  140.             if(true)
  141.             {
  142.                if(Process_State != null)
  143.                {
  144.                   if(true)
  145.                   {
  146.                      Process_State();
  147.                      if(true)
  148.                      {
  149.                         addr27:
  150.                         mCollide.Update();
  151.                         if(true)
  152.                         {
  153.                            if(MapMove())
  154.                            {
  155.                            }
  156.                            addr36:
  157.                            if(mDisposed)
  158.                            {
  159.                               ┬º┬ºgoto(addr38);
  160.                            }
  161.                            else
  162.                            {
  163.                               ┬º┬ºgoto(addr39);
  164.                            }
  165.                         }
  166.                         Process_ReachedObjective();
  167.                      }
  168.                      ┬º┬ºgoto(addr36);
  169.                   }
  170.                   addr38:
  171.                   return;
  172.                }
  173.                ┬º┬ºgoto(addr27);
  174.             }
  175.             addr39:
  176.             Process_Children();
  177.             _loc1_ = OrientatePoint(mSprite.mObjects["front"].mPosition.clone(),mPosition);
  178.             ┬º┬ºgoto(addr41);
  179.          }
  180.          addr41:
  181.          ┬º┬ºpush(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x));
  182.          if(true)
  183.          {
  184.             ┬º┬ºpush(┬º┬ºpop() || mDead);
  185.          }
  186.          if(┬º┬ºpop())
  187.          {
  188.             mDead = true;
  189.          }
  190.          if(mDead)
  191.          {
  192.             AddThing(new CEffectExplosionLarge(mPosition.Clone(),250));
  193.             DispatchDispose();
  194.             Explode();
  195.          }
  196.       }
  197.       
  198.       override public function get mPrize() : int
  199.       {
  200.          return CPeepM16.mCost * 20;
  201.       }
  202.       
  203.       public function State_NOPATH_Exit() : void
  204.       {
  205.       }
  206.       
  207.       public function State_NOPATH_Enter() : void
  208.       {
  209.       }
  210.       
  211.       public function State_FOLLOWPATH() : void
  212.       {
  213.          if(!mPath.MoveAlong(mSpeed))
  214.          {
  215.             mDead = true;
  216.             return;
  217.          }
  218.          mPath.OrientateThing(this);
  219.       }
  220.       
  221.       override public function get mBaseDamage() : Number
  222.       {
  223.          return 200;
  224.       }
  225.    }
  226. }
  227.